package day2;

/**
 * @author joker
 * @date 2022/4/13 0013 - 14:56
 */
class Root{
    public static void main(String[] args) {
        new Leaf();
        System.out.println("********");
        new Leaf();
    }
    static{
        System.out.println("Root的静态初始化块");//1
    }
    {
        System.out.println("Root的普通初始化块");//4
    }
    public Root(){
        super();
        System.out.println("Root的无参数的构造器");//5
    }
}
class Mid extends Root{
    static{
        System.out.println("Mid的静态初始化块");//2
    }
    {
        System.out.println("Mid的普通初始化块");//6
    }
    public Mid(){
        super();
        System.out.println("Mid的无参数的构造器");//7
    }
    public Mid(String msg){
        //通过this调用同一类中重载的构造器
        this();
        System.out.println("Mid的带参数构造器，其参数值："//8
                + msg);
    }
}
class Leaf extends Mid{
    static{
        System.out.println("Leaf的静态初始化块");//3
    }
    {
        System.out.println("Leaf的普通初始化块");//9
    }
    public Leaf(){
        //通过super调用父类中有一个字符串参数的构造器
        super("尚硅谷");
        System.out.println("Leaf的构造器");//10
    }
}

